from django import template
register = template.Library()

@register.filter
def get_item(dictionary, key):
    return dictionary.get(key)

@register.filter
def split_by(value, sep='|'):
    """将字符串按指定分隔符分割为列表"""
    return value.split(sep) if value else []
